package demo.gaobo.com.myapplication.activity;

import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.Bind;
import butterknife.OnClick;
import demo.gaobo.com.myapplication.IconFontTextView;
import demo.gaobo.com.myapplication.R;
import demo.gaobo.com.myapplication.base.BaseActivity;

/**
 * user：lqm
 * desc：搜索界面
 */

public class SearchActivity extends BaseActivity<SearchView, SearchPresenter> implements SearchView {

    @Bind(R.id.et_search)
    EditText etSearch;
    @Bind(R.id.rl_search)
    RelativeLayout rlSearch;
    @Bind(R.id.tv_return)
    TextView tvReturn;
    @Bind(R.id.tv_clean_input)
    IconFontTextView tvCleanInput;
    @Bind(R.id.ll_hot_key)
    LinearLayout llHotKey;



    @Override
    protected SearchPresenter createPresenter() {
        return new SearchPresenter();
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_search;
    }

    @Override
    protected String setToolBarTitle() {
        return "搜索";
    }

    @Override
    public void initView() {

    }

    @Override
    public void initListener() {
        etSearch.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });

    }

    @OnClick({R.id.tv_clean_input, R.id.tv_return})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_clean_input:
                etSearch.setText("");
                break;
            case R.id.tv_return:
                finish();
                break;
        }

    }




}
